package com.kaifamiao.quant;

import org.apache.shiro.authz.annotation.RequiresRoles;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import java.util.HashMap;
import java.util.Map;
@RestController
@RequestMapping("/kaifamiao/base")
//@RequiresRoles({"admin", "common"})

public class BaseDataController {
    @Autowired
    private RestTemplate restTemplate;

//    @Value("${config.token}")
//    private String token;

    @RequestMapping("/stocklist")
    public Object stocks(){

        Map<String,Object> mp =new HashMap<>();
        mp.put("api_name","stock_basic");
        mp.put("token","531f7eda35d265a43c7091a5971802aab320a80c16afb6e7164c595a");
        Map<String,String> mp2 =new HashMap<>();

        mp2.put("list_status","L");


        mp2.put("market","创业板");
        mp.put("params",mp2);
        mp.put("fields","ts_code,symbol,name,fullname,area,industry,exchange");

        mp.put("Content-type","application/json;charset=utf8");
        Object responseVo = restTemplate.postForObject("http://api.waditu.com", mp, Object.class);

        return responseVo;

    }

}
